Skip to main content

Example: Sensor App for Android

Product: Link to CODESYS Sensor App for Android

The sample project shows how to send sensor data from an Android smartphone to a CODESYS controller.

Installation

Installation of the Android app

The Android app CODESYS Sensor App can be installed only from the Google Play Store.

Search for "CODESYS Sensor App" in the Google Play Store and install the application on your Android device.

Installation of the CODESYS package

Install the CODESYS Sensor App for Android Example package via the CODESYS Installer. Use the download link at the bottom of this page.

Configuration

The Android app uses network variables to send the sensor data of the Android device to the CODESYS controller via UDP on ports 1202 and 1059. The Android device (for example, smartphone or tablet) and the CODESYS controller must be located in the same local network. The easiest way to achieve this is by using the Wi-Fi hotspot of the Android device.

Procedure. Setting up a Wi-Fi hotspot on an Android device
  1. Set up a Wi-Fi hotspot on the Android device.

    (for example, via SettingsHotspot and tetheringWLAN hotspot)

  2. Connect the CODESYS controller to the Wi-Fi hotspot and find the IP address of the controller for the Wi-Fi adapter (for example, using the ipconfig command).

Procedure. Preparation of the CODESYS Development System
  1. Open the CODESYS sample project AndroidSensorApp.project.

  2. Start the SensorReceiver application on the controller.

Procedure. Configuration of the Android device
  1. Start the "CODESYS Sensor App".

  2. In the Target IP address field, specify the IP address of the CODESYS controller.

  3. Switch the Send sensor data to control setting to ON.

The current sensor data is now being send to the controller and displayed in the visualization.

Important

If the CODESYS application is not receiving any data, then check the port forwarding settings in your network and firewall.

Functional scope

. Functions of the Android app "CODESYS Sensor App"
  • Target IP address: Setting of the IP address of the CODESYS controller

  • Send sensor data to control: Sends the sensor data to the specified IP address

  • Messages: Status messages for the CODESYS app

  • Start Speech Recognition: Starts the automatic word recognition by Google

    (Only when connected to the Internet)

  • Recognized Words: List of recognized words

. Sample project: AndroidSensorApp.project
  • The received sensor data is displayed in the visualization of the SensorReceiver application. The words recognized by the speech recognition are stored in the string strCommandThe network variable NVL is stored.

_codesys_sensor_app_1.png

Screenshot: CODESYS Sensor App​ for Android on the Android device

_codesys_sensor_app_2.png

Screenshot: Display of sensor data in the CODESYS Development System (AndroidSensorApp.project)

System requirements and restrictions

Programming system

CODESYS Development System (version 3.5.17.0 or higher)

Runtime system

CODESYS Control Win (version 3.5.17.0)

Tip

Use the free Device Reader project (available in the CODESYS Store International) to find out the functions supported by the controller.

Add-on components

  • Android device (for example, a smartphone) with the CODESYS Sensor app installed from the Google Play Store

  • CODESYS Development System-capable controller

Additional requirements

  • Network connection between the Android device and the CODESYS Development System controller

  • Internet connection (for voice control)

Note

_example_icon.png DOWNLOAD Project